<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

	use UserTrait, RemindableTrait;

	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
	protected $hidden = array('password', 'remember_token');
	
	protected $guarded = array('id', 'password_confirmation');
		
	public static $rules = [
		'name' => 'required|min:5',
		'username' => 'required|min:5',
		'email' => 'required|email'
	];
	
	/**
	 * A user with many groups, where the groups are also shared by other users. 
	 * 
	 * @return void
	 */
	public function groups()
	{
		return $this->belongsToMany("Group");
	}

}
